﻿namespace DesignModeConsole.创建型.工厂方法模式;

/// <summary>
/// 当创建IReadFile的方法比较复杂，或许需要包含其他扩展，那么就更推荐使用工厂方法
/// </summary>
public interface IReadFileParserFactory
{
    IReadFile CreateParser();
}

public class ReadJsonFileParserFactory : IReadFileParserFactory
{
    public IReadFile CreateParser()
    {
        return new ReadJsonFile();
    }
}

public class ReadXmlFileParserFactory : IReadFileParserFactory
{
    public IReadFile CreateParser()
    {
        return new ReadXmlFile();
    }
}

public class ReadTxtFileParserFactory : IReadFileParserFactory
{
    public IReadFile CreateParser()
    {
        return new ReadTxtFile();
    }
}